# 数据位移

# df.shift（）  移动幅度（整数） *1
import  pandas as pd

data = [110,109,78,130,111]
index = [1,2,3,4,5]

df = pd.DataFrame(data=data,index=index,columns=['python'])

df['升降'] = df['python'] - df['python'].shift()
# print(df['python'].shift())
# print(df)

# 数据转换 （一列转多列）
# df 转 字典、列表、元祖.....
# split()  xxx.str.split()
pd.set_option('display.unicode.east_asian_width',True)
pd.set_option('display.max_columns',500)
pd.set_option('display.width',1000)

df = pd.read_excel('mrbooks.xls',usecols=['买家会员名','收货地址'])
df1 = pd.read_excel('mrbooks.xls',usecols=['买家会员名','宝贝标题'])

series = df['收货地址'].str.split(" ",expand=True)

print(series)

df['省'] = series[0]
df['市'] = series[1]
df['区'] = series[2]
# print(df.head())


df1  =df1.join( df1['宝贝标题'].str.split('，',expand=True))
print(df1.head())





